<script>
import { mapGetters } from 'vuex'
export default {
  name: "Tabbar",
  props: {
    path: {
      type: String,
      default: ''
    },
  },
  computed: {
    ...mapGetters(['token'])
  },
  data() {
    return {
      tabbarList: [
        {
          "iconPath": "/static/tabbar/home.png",
          "pagePath": "pages/index/index",
          "selectedIconPath": "/static/tabbar/home_active.png",
          "text": "首页"
        },
        {
          "iconPath": "/static/tabbar/msg.png",
          "pagePath": "pages/map/index",
          "selectedIconPath": "/static/tabbar/msg_active.png",
          "text": "消息"
        },
        {
          "iconPath": "/static/tabbar/user.png",
          "pagePath": "pages/my/index",
          "selectedIconPath": "/static/tabbar/user_active.png",
          "text": "我的"
        }
      ]
    }
  },
  methods: {
    changeTabBar(index) {
      console.log('index',index)
      // if (index === 2) {
      //   return
      // }
      let path = this.tabbarList[index].pagePath
      console.log('path',path)
      uni.switchTab({
        url: '/' + path
      })
    },
  },
}
</script>

<template>
  <u-tabbar
    height="60px"
    :hide-tab-bar="true"
    active-color="#1296db"
    in-active-coloir="#F2F2F2"
    :list="tabbarList"
    @change="changeTabBar"
  ></u-tabbar>
</template>

<style scoped lang="scss">
</style>
